import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Jiang Jinxi
 * Date: 2024-04-20
 * Time: 14:18
 */
public class Account {
    private int id;
    private double balance;
    private double annualInterestRate;
    private Date dateCreated;

    public Account(){

    }
    public Account(int id,double balance){
        this.id = id;
        this.balance = balance+getMonthlyInterest();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getAnnualInterestRate() {
        return annualInterestRate;
    }

    public void setAnnualInterestRate(double annualInterestRate) {
        this.annualInterestRate = annualInterestRate;
    }
    public Date getDataCreated(){
       Date date = new Date();
        return date;
    }
    public double getMonthlyInterestRate(){
        return annualInterestRate/12;
    }
    public void withDraw(double money){
        balance = balance - money;
    }
    public void deposit(double money){
        money = money+getMonthlyInterest();

        balance = balance + money;
    }
    public double getMonthlyInterest(){
        double monthlyInterest = balance*getDataCreated().getMonth()-getMonthlyInterestRate();
        return monthlyInterest;
    }

}
